#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Object/Object.h"
#include "Misc/EngineEditorMacros.h"
#include "Window/WindowEnums.h"
#include "Math/IntPoint.h"
#include <limits>
#include "EditorWindowModel.m.h"

class REditorPageAreaManagerModel;

//store all data of a window
RCLASS(ExtraHeader=["PageArea/EditorPageAreaManagerModel.h"])
class ENGINEEDITOR_API REditorWindowModel : public RObject
{
    ROBJECT

public:
    void FirstTimeInitializeObject() override;

    void Focuse();

    EWindowSizeType GetWindowSizeType() const;
    void SetWindowSizeType(EWindowSizeType InType);
    TDelegate<void> OnWindowSizeTypeChanged;

    //only effected when SizeType is Normal
    SIntPoint GetWindowSize() const;
    void SetWindowSize(const SIntPoint& InSize);
    TDelegate<void> OnWindowSizeChanged;

    //only effected when SizeType is Normal
    SIntPoint GetWindowPosition() const;
    void SetWindowPosition(const SIntPoint& InPosition);
    TDelegate<void> OnWindowPositionChanged;

protected:

    RFIELD()
    EWindowSizeType WindowSizeType=EWindowSizeType::Maximized;
    RFIELD()
    SIntPoint WindowSize=SIntPoint(800,600);
    
    //if X ==std::numeric_limits<int64_t>::max() or Y ==std::numeric_limits<int64_t>::max(),that 
    // means put to screen center
    RFIELD()
    SIntPoint WindowPosition=SIntPoint(std::numeric_limits<int64_t>::max(),std::numeric_limits<int64_t>::max());


//页面相关
public:
    
    //editor area
    TSharedObjectPtr<REditorPageAreaManagerModel> GetPageArea() const;
protected:
    //area for edit page
    RFIELD()
    TSharedObjectPtr<REditorPageAreaManagerModel> PageArea;
};